﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;

public partial class _Default : System.Web.UI.Page 
{
    static int dupa = 123;
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = "dupa";
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int idx = Int32.Parse(TextBox1.Text);
        Guid g = new Guid("85d6e6c7-7f04-4c4d-80bb-0b7a688d5020");
        
        WebWorkflowManager.getInstance(Response).CreateWorkflow(g, idx);
        WebWorkflowManager.getInstance(Response).ShowPage(g, idx);
        
        
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        int instanceId = Int32.Parse(TextBox1.Text);

        //to ponizej to jest przyklad uzyskiwania guida dla danej instancji na potrzeby tego przykaldu
        //Ty to oczywiscie zrobisz po swojemu i na pewno lepiej. Tu chodzi jedynie o to zeby moc kontynuowac rozpoczety flow
        Guid g = Guid.Empty;
        try
        {

             g = WebWorkflowManager.getInstance(Response).getGuidFor(instanceId);
        }
        catch (Exception)
        {

        }


        WebWorkflowManager.getInstance(Response).ShowPageNoPreconditions(g, instanceId);

    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        int idx = Int32.Parse(TextBox1.Text);

        Guid g = new Guid("0c62fff7-28d9-478c-a158-e133f854d452");

        WebWorkflowManager.getInstance(Response).CreateWorkflow(g, idx);
        WebWorkflowManager.getInstance(Response).ShowPage(g,idx);  

    }
}
